<HTML><HEAD> <!-- ----------------- Environment Check ----------------- --> <SCRIPT LANGUAGE="JavaScript"> <!-- /* THE JAVASCRIPT COOKBOOK by Erica Sadun, webrx@mindspring.com J. Brook Monroe, mrprogguy@techie.com Copyright (c)1998 by Charles River Media. All Rights Reserved. This applet can only be re-used or modifed by license holders of the JavaScript Cookbook CD-ROM. Credit must be given in the source code and this copyright notice must be maintained. If you do not hold a license to the JavaScript Cookbook, you may NOT duplicate or modify this code for your own use. Use at your own risk. No warranty is given or implied of the suitability of this applet for any specific application. Neither Erica Sadun nor Charles River Media will be held responsible for any unwanted effects due to the use of this applet or any derivative. */ function InfoTable() { var browser = navigator.appName; var version = navigator.appVersion; document.writeln('<TABLE CELLPADDING=3 BORDER=2>'); document.writeln('<TR><TD BGCOLOR="#A0A0A0">Browser name</TD><TD>'+browser+'</TD></TR>'); document.writeln('<TR><TD BGCOLOR="#A0A0A0">Browser version</TD><TD>'+version+'</TD></TR>'); document.writeln('<TR><TD BGCOLOR="#A0A0A0">User Agent header</TD><TD>'+navigator.userAgent+'</TD></TR>'); document.writeln('</TABLE><BR><BR>'); if(browser == 'Netscape' && version.charAt(0) >= '3') { document.writeln('Plug-Ins available:<BR><UL>'); var m = navigator.plugins.length; for(var i = 0; i < m; i++) { var aPlugin = navigator.plugins[i]; document.writeln('<LI>'+aPlugin.name+' -- '+aPlugin.description+'</LI>'); } document.writeln("</UL>"); } else document.writeln('This browser does not support the <i>Plugin</i> object, so no way exists to tell what extra features have been added to this browser.'); } //--> </SCRIPT> <BODY bgcolor="ffffff" link="0000ff" vlink="770077"> <FONT COLOR="007777"><H1><IMG SRC="../GRAFX/UTENS.JPG" WIDTH=80 HEIGHT=50 ALIGN = LEFT>Environmental Issues</H1></FONT> <BLOCKQUOTE><FONT COLOR="770000"> This script displays information about the current browser.<p> </FONT></BLOCKQUOTE> <SCRIPT LANGUAGE="JavaScript"><!-- InfoTable(); //--></SCRIPT> <FONT COLOR="007777"><H2>Discussion</H2></FONT> <FONT SIZE=4> If you're concerned about having your Web pages run with as many JavaScript-enabled browsers as possible, you often need to know more about what browser the user has. MSIE and NN/NC support different features and functions, and different versions within the same browser support different features. For example, NN3.0 and above supports the <FONT color="#770000">String.split()</FONT> function, while NN2.0 and all MSIE versions before 4.0 don't. Missing functionality in an older version might cause you to code something differently to obtain the same results. (The <i>JavaScript Bach</i> piano script is a prime example of this--and so it this script!)<BR><BR> Also, you might be depending on the presence of a plug-in that the user has never downloaded, or on support for a MIME type the user (or the user's Internet service provider) has never heard of. You wouldn't want to continue running the script because you know that there's an error message looming on the user's horizon. By taking stock of the browser environment, you can make sure that you present your scripts and Web pages to the broadest possible audience, and with the greatest available number of features. <BR><BR><h5>Copyright ©1998 by Charles River Media, All Rights Reserved</h5> </BODY> </HTML>